package cn.jiyun.student.controller;

import cn.jiyun.student.pojo.AdchannelVo;
import cn.jiyun.student.pojo.Student;
import cn.jiyun.student.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Slf4j
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;
    @RequestMapping("/add")
    public AdchannelVo add(@RequestBody Student student){
        log.info("studentList:{}",student);
        return studentService.add(student);
    }
    @RequestMapping("/{id}")
    public List<Student> findById(@PathVariable("id")Integer id){
        return studentService.findById(id);
    }
    @RequestMapping("/edit/{cid}")
    public AdchannelVo delByCid(@PathVariable("cid")Integer cid){
        return studentService.delById(cid);
    }
}
